package com.ewo.service.impl;

import com.ewo.entity.Emp;
import com.ewo.entity.EmpInfo;
import com.ewo.entity.workOrder.WorkOrderInfo;
import com.ewo.mapper.EmpMapper;
import com.ewo.service.EmpService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {
    @Resource
    EmpMapper empMapper;


    @Override
    public List<Emp> findAllEmp() {
        return empMapper.findAllEmp();
    }

    @Override
    public Emp findEmpByUsername(String username) {
        return empMapper.findEmpByUsername(username);
    }

    //查询员工的页面工单显示信息
    public int findEmpInfoByUsername(int empId , int work_status){
        return empMapper.findEmpInfoByUsername(empId,work_status);
    }
    //根据员工id及工单状态查询工单信息
    //根据员工id及工单状态查询工单信息
    public List<WorkOrderInfo> findEmpOrderByEmpIdAndWork_status(int empId , int work_status){
        return empMapper.findEmpOrderByEmpIdAndWork_status(empId, work_status);
    }
    @Override
    public int addEmp(Emp emp) {
        return empMapper.addEmp(emp);
    }

    //修改员工信息
    public int updateEmpById(Emp emp){
        return empMapper.updateEmpById(emp);
    }
    //修改员工最后登录信息
    public int updateEmpByUsername(String username, LocalDateTime loginTime){
        return empMapper.updateEmpByUsername(username,loginTime);
    }

    //根据username查询password
    public String FindPwdByUsername(String username){
        return empMapper.FindPwdByUsername(username);
    }

    //根据username修改password
    public int UpdatePwdByUsername(String username,String password){
        return empMapper.UpdatePwdByUsername(username, password);
    }
}
